/**
 *
 */
package anyware.common.restlet;

import org.restlet.resource.Representation;
import org.restlet.resource.Variant;

/**
 * Helper class to transform between entity (generic Java object) and its
 * representation.
 * 
 * @author keke<keke@codehaus.org>
 * @revision $Revision: 111 $
 * @version 0.0.1
 */
public interface RepresentationHelper {
    /**
     * @param name
     * @param representation
     * @return entity represented by this {@code representation}.
     * @exception IllegalRepresentationException
     *                if {@code name} or {@code representation} is {@code null}.
     */
    Object toEntity(String name, Representation representation);

    /**
     * @param name
     * @param entity
     * @param variant
     * @return representation representing the {@code entity}.
     * @exception IllegalRepresentationException
     *                if any of parameters is {@code null}.
     */
    Representation toRepresentation(String name, Object entity, Variant variant);

}
